package person.csx.studentgradle.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import person.csx.studentgradle.model.Course;
import person.csx.studentgradle.service.CourseService;

import java.util.List;
@Controller
@RequestMapping("/Course")
public class CourseController {
    @Autowired
    private CourseService courseServiceImpl;
    @RequestMapping("list.do")
    public String courseList(Model model){
        List<Course> courses = courseServiceImpl.findCourse();
        model.addAttribute("courses",courses);
        return  "/course/CourseList";
    }
}
